package hong.jun.feign.fallback;

import feign.hystrix.FallbackFactory;
import hong.jun.feign.client.Resources2FeignClient;
import org.springframework.stereotype.Component;

@Component
public class Resources2FeignClientFallback implements FallbackFactory<Resources2FeignClient> {

    @Override
    public Resources2FeignClient create(Throwable throwable) {
        return new Resources2FeignClient() {
            @Override
            public String list() {
                throwable.printStackTrace();
                return "啊。降级了...";
            }

            @Override
            public String save() {
                throwable.printStackTrace();
                return "啊。降级了...";
            }
        };
    }
}
